package com.woody.aggregate.app.web.saas;

import com.woody.aggregate.ShopIdQueryDTO;
import com.woody.aggregate.application.service.saas.SaasShopConfigService;
import com.woody.aggregate.saas.api.SaasShopConfigApi;
import com.woody.aggregate.saas.dto.AddOrUpdateSaasShopConfigDTO;
import com.woody.aggregate.saas.vo.SaasShopConfigVO;
import com.woody.base.model.Response;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@Api(tags = "saas商圈配置")
public class SaasShopConfigController implements SaasShopConfigApi {

    @Resource
    private SaasShopConfigService saasShopConfigService;

    @Override
    public Response<Long> addOrUpdate(AddOrUpdateSaasShopConfigDTO addOrUpdateSaasShopConfigDTO) {
        Long id = saasShopConfigService.saveOrUpdate(addOrUpdateSaasShopConfigDTO);
        return Response.success(id);
    }

    @Override
    public Response<SaasShopConfigVO> getByShopId(ShopIdQueryDTO shopIdQueryDTO) {
        SaasShopConfigVO saasShopConfigVO = saasShopConfigService.getByShopId(shopIdQueryDTO.getShopId());
        return Response.success(saasShopConfigVO);
    }
}
